<?
function show_sections($sections){
    echo "<ul>";
    foreach($sections as $section){
        $id = Arr::get($section, 'id', 0);
        $hide = Arr::get($section, 'hide');
        echo "<li><div class=\"section $hide\">
                    <div class=\"info\">
                        <p>{$section['name']}</p>
                        <a>{$section['href']}</a>
                    </div>
                    <div class=\"actions\">
                        <a href=\"/admin/section/add?id_parent=$id\" title=\"add subsection\">+</a>
                        <a href=\"/admin/section/hide?id=$id\" title=\"hide/show\">h/s</a>
                        <a href=\"/admin/section/edit?id=$id\" title=\"edit\">ed</a>
                        <a href=\"/admin/section/delete?id=$id\" title=\"delete\">del</a>
                        <a href=\"/admin/section/up?id=$id\" title=\"up\">&uarr;</a>
                        <a href=\"/admin/section/down?id=$id\" title=\"down\">&darr;</a>
                    </div>
                   </div>";
        if(isset($section['subsections'])){
            echo show_sections($section['subsections']);    
        }
        echo "</li>";
    }
    echo "</ul>";
}
?>

<div id="section">
<a href="/admin/section/add?id_parent=0" class="root">+</a>
<? show_sections($sections); ?>
</div>